<!DOCTYPE html>
<html>
<head>
  <title>环境保护登录</title>
  <style>
   body {
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: Arial, sans-serif;
        background-color: #f2f2f2;
        margin: 0;
        padding: 0;
        background: url(./images/1.png);
        background-size: 100%;
      }
      
      .container {
        width: 400px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 20px;
        background-color: #fff;
        border: 1px solid #ccc;
        border-radius: 5px;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
      }
      
      h1 {
        text-align: center;
        color: #333;
      }
      
      label {
        display: block;
        margin-bottom: 10px;
        color: #666;
      }
      
      input[type="text"],
      input[type="password"] {
        width: 100%;
        padding: 10px;
        border: 1px solid #ccc;
        border-radius: 3px;
      }
      
      input[type="submit"] {
        width: 110%;
        padding: 10px;
        background-color: #4CAF50;
        border: none;
        color: #fff;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        margin-top: 20px;
      }
      
      input[type="submit"]:hover {
        background-color: #45a049;
      }
  </style>
  <script>
    function redirectToIndex() {
      var username = document.getElementById("username").value;
      var password = document.getElementById("password").value;

      // 模拟服务器验证逻辑，检查用户名和密码是否匹配
      if (username === "admin" && password === "1123233") {
        window.location.href = "index.html";
      } else {
        alert("用户名或密码错误，请重新输入！");
      }
    }

    function redirectToRegister() {
      window.location.href = "register.html";
    }
  </script>
</head>
<body>
  <div class="container">
    <h1>环境保护登录</h1>
    <div>
      <label for="username">用户名:</label>
      <input type="text" id="username" name="username" placeholder="请输入用户名" required>
      
      <label for="password">密码:</label>
      <input type="password" id="password" name="password" placeholder="请输入密码" required>
      
      <input type="submit" value="登录" onclick="redirectToIndex()">
      <p>还没有账号？<a href="register.html">立即注册</a></p>
    </div>
  </div>
</body>
</html>